#pragma once
#include"hash.h"
namespace mutou
{
	template <class K>
	class unordered_set
	{
		struct SetofT
		{
			const K& operator()(const K& val)
			{
				return val;
			}
		};
	public:
		typedef typename hash_bucket::Hash_Table<K, const K, SetofT>::Iterator iterator;
		typedef typename hash_bucket::Hash_Table<K, const K, SetofT>::ConstIterator const_iterator;
		const_iterator begin()const
		{
			return set.Begin();
		}
		const_iterator end()const
		{
			return set.End();
		}
		iterator begin()
		{
			return set.Begin();
		}
		iterator end()
		{
			return set.End();
		}
		unordered_set(size_t n  = 8)
			:set(n)
		{

		}
		
		pair<iterator, bool> Insert(const K& val)
		{
			return set.insert(val);
		}
		bool Erase(const K& val)
		{
			return set.erase(val);
		}
	private:
		hash_bucket::Hash_Table<K,const K,SetofT> set;
	};
	void test03(const unordered_set<int>& set)

	{
	
	for (auto e : set)
	{
		cout << e << " ";
	}
	cout << endl;
	}
	void test02()
	{
		 unordered_set<int> set(10);
		int arr[] = { 19,30,5,36,13,20,21,12,24,96 };
		for (auto e : arr)
		{
			set.Insert(e);
		}
		test03(set);
		for (auto e : arr)
		{
			set.Erase(e);
		}
		
	}
	
}